import HandleBtn from '@/components/HandleBar/btn';
//import type { UploadProps } from 'antd';
//import { Upload } from 'antd';
import Access from '@/components/Access';
import React from 'react';
import { useIntl } from 'umi';

type ToolBarProps = {
  tableRef: React.MutableRefObject<null>;
};
const ToolBarRender: React.FC<ToolBarProps> = ({ tableRef }) => {
  // const uploadProps: UploadProps = {
  //   name: 'file',
  //   multiple: true,
  //   showUploadList: false,
  //   customRequest: async (info) => {
  //     tableRef?.current?.upload(info);
  //   },
  // };
  const intl = useIntl();
  return (
    <div className="global-has-tool-bar">
      <Access perm="sys:device:add" key="add">
        <HandleBtn
          handleType="add"
          key="add"
          onClick={() => {
            console.log(tableRef, '相应的');

            tableRef?.current?.add?.();
          }}
        >
          {intl.formatMessage({ id: 'systemManagement.generalProcedure.new' })}
        </HandleBtn>
      </Access>
      {/* <Upload {...uploadProps}>
        <HandleBtn handleType="import">导入</HandleBtn>
      </Upload>
      <HandleBtn
        handleType="export"
        onClick={() => {
          tableRef?.current?.download();
        }}
      >
        导出
      </HandleBtn> */}
      <Access perm="sys:device:del" key="del">
        <HandleBtn
          onClick={() => {
            tableRef?.current?.delete();
          }}
          handleType="delete"
          key="delete"
        >
          {intl.formatMessage({ id: 'systemManagement.generalProcedure.batchDelete' })}
        </HandleBtn>
      </Access>
    </div>
  );
};

export default ToolBarRender;
